<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>实验</title>
</head>
<body>
            
                <div ng-app="myApp" ng-controller="validateCtrl" class="form-group">  
                    <label class="control-label">姓名：</label>  
                    <input type="text" class="form-control" ng-model="name" ng-change="txtChange();" />  
                </div>  
            

      <script src="lib/jquery/dist/jquery.min.js"></script>
      <script src="lib/bootstrap/js/bootstrap.min.js"></script>
      <script src="lib/angular/angular.min.js"></script>
        <script>
           
           var app = angular.module('myApp', []);  
                    app.controller('validateCtrl', function ($scope) {  
                        $scope.txtChange = function () {  
                            console.info($scope.name);  
                        }  
                       
                    });  










//              var app = angular.module('myApp',[]);
//                     app.controller('myController', function ($scope) {
//                         $scope.list = [
//                             {'id': 101},
//                             {'id': 102},
//                             {'id': 103},
//                             {'id': 104}
//                         ];
                        
                       
//                         $scope.selectAll = function() {
//                              console.log($scope.select_all)
//                             angular.forEach($scope.list,function(i) {

//                                 if($scope.select_all) {
//                                     i.checked = true;
//                                 }else {
//                                     i.checked = false;
//                                 }
//                             })
//                         };

//      $scope.array = [];

//     $scope.selectOne = function () {

//         angular.forEach($scope.list , function (i) {
//          var index = $scope.array.indexOf(i.id);
//              console.log(index)
//             if(i.checked && index === -1) {
//                 $scope.array.push(i.id);
//             } else if (!i.checked && index !== -1){
//                 $scope.array.splice(index, 1);
//                 console.log($scope.array)
//             };
//         })

//         if ($scope.list.length === $scope.array.length) {
//             $scope.select_all = true;
//         } else {
//             $scope.select_all = false;
//         }
//     }
// });

          
          
                 // var arr = ['a','b','c']

                 // console.log(arr.splice(1,1))
     </script>
</body>
</html>